/*
package com.deer.wms.base.system.web.rocketmq;

import com.alibaba.fastjson.JSONArray;
import com.deer.wms.base.system.model.bill.BillInDetail;
import com.deer.wms.base.system.model.bill.BillInMaster;
import org.apache.commons.lang3.time.StopWatch;
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.apache.rocketmq.remoting.exception.RemotingException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.UnsupportedEncodingException;
import java.util.List;

*/
/**
 * @Author: Xiaour
 * @Description:生产者
 * @Date: 2018/8/9 14:52
 *//*


@Component
public class Producer {

    */
/**
     * 生产者的组名
     *//*

    @Value("${apache.rocketmq.producer.producerGroup}")
    private String producerGroup;

    private DefaultMQProducer producer;
    */
/**
     * NameServer 地址
     *//*

    @Value("${apache.rocketmq.namesrvAddr}")
    private String namesrvAddr;

    @PostConstruct
    public void defaultMQProducer() {
        //生产者的组名  创建生产者
        producer= new DefaultMQProducer(producerGroup);
        //指定NameServer地址，多个地址以 ; 隔开
        producer.setNamesrvAddr(namesrvAddr);
        producer.setVipChannelEnabled(false);
        try {
            producer.start();   //调用start()方法启动一个producer实例   启动生产者
            System.out.println("-------->:producer启动了");
        } catch (MQClientException e) {
            e.printStackTrace();
        }
    }


    public SendResult send(String topic, String tags, String body) throws InterruptedException, RemotingException, MQClientException, MQBrokerException, UnsupportedEncodingException {
        Message message = new Message(topic, tags,body.getBytes(RemotingHelper.DEFAULT_CHARSET));//message构造方法
        StopWatch stop = new StopWatch();
        stop.start();
        //调用producer的send()方法发送消息
        //这里调用的是同步的方式，所以会有返回结果
        SendResult result = producer.send(message);
        stop.stop();
        return  result;
    }
}
*/
